
import common from "../../common/common";

const state = {

    token: '',
    userinfo: '',
    refreshToken: "",

};

// //改变值的地方派发
const mutations = {
    changeToken(state, token) {
        state.token = token
         localStorage.setItem(common.constData.TOKEN,token)
    },

    changeUserinfo(state, userinfo) {
        state.userinfo = userinfo
        localStorage.setItem(common.constData.USERINFO,userinfo)
    },
    changeRefreshToken(state, refreshToken) {
        state.refreshToken = refreshToken
    }
};


//派发的方法
const actions = {

    changeToken(ctx, token) {
        ctx.commit('changeToken', token)
    }

};


export default{

    state,
    mutations,
    actions

}







